home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 1 / LSD Compendium Deluxe 1.iso / a / programming / assembly / no880.lha / no880.s < prev   
Encoding:
Text File  |  1994-06-05  |  3.8 KB  |  214 lines

  1.  
  2.     ;stops 880 requesters on a A500. not needed in ks2+
  3.     ;by shagratt/LSD
  4.  
  5.     section    lard,code
  6.  
  7. code:    IncDir    "DH0:Include/"
  8.     Include    Intuition/Intuition.I
  9.     Include    Intuition/Intuition_Lib.I
  10.     Include    Libraries/dos_LIb.i
  11.     Include    Libraries/Dos.i
  12.     Include    Exec/Exec_Lib.I
  13.     Include    Exec/Exec.I
  14.     Include    Misc/EasyStart.i
  15.  
  16.     move.l    4,a6
  17.     move.l    20(a6),d0        ; execbase verison
  18.     cmp.l    #$00220002,d0    ; check ks version
  19.     bgt    .error        ; coz ks2 does it anyway & sometimes it fucks up!
  20.  
  21.     Lea    DosName,A1
  22.     Moveq    #0,D0
  23.     CALLEXEC    OpenLibrary
  24.     Move.l     D0,_DOSBase
  25.     Beq    .error
  26.  
  27.     lea    code(pc),a0
  28.     move.l    -4(a0),d3
  29.     move.l    d3,segaddress
  30.     move.l    #0,-4(a0)
  31.     
  32.     move.l    _DOSBase,a6
  33.     move.l    #myname,d1
  34.     move.l    #0,d2
  35.     move.l    #4000,d4
  36.     jsr    -138(a6)            ; create proc
  37.  
  38. .error    clr.l    d0    
  39.     rts
  40.  
  41.  
  42.     Section    Main,Code
  43. Start:
  44.     Lea    IntName,A1
  45.     Moveq    #0,D0
  46.     CALLEXEC    OpenLibrary
  47.     Move.l    D0,_IntuitionBase
  48.     Beq    Error
  49.  
  50.     Lea    MainWindow,a0
  51.     CALLINT    OpenWindow
  52.     Move.l    D0,_MyWinBase
  53.     Beq    CloseInt
  54.     Move.l    D0,A0
  55.     Move.l    wd_RPort(A0),_MyWinRPort
  56.     Move.l    wd_UserPort(a0),_MyWinUserPort
  57.  
  58.     ******************* this is the no 880 patch *****************
  59.  
  60.     move.l    _intuitionbase,a1
  61.     move.l    a1,a0
  62.  
  63.     lea    -346(a1),a0        ; ks 1.2/1.3 offset (autorequest)
  64.     cmp.w    #$4ef9,-588(a1)    ; check if jump
  65.     bne    ks210_noalert
  66.  
  67.     lea    -586(a1),a0        ; ks 2.0 offset (autorequest)
  68.     bra    ks13_noalert
  69.  
  70. ks210_noalert:
  71.     cmp.w    #$4ef9,-594(a1)    ; check if jump
  72.     bne    ks13_noalert
  73.  
  74.     lea    -588(a1),a0        ; ks 2.0 offset (autorequest)
  75.  
  76. ks13_noalert:
  77.     move.l    a0,reqpos
  78.     move.l    (a0),oldreq+2
  79.     move.l    #do_alert,(a0)
  80.  
  81. WaitLoop
  82.     Move.l    _MyWinUserPort,A0
  83.     CALLEXEC    WaitPort
  84.     Move.l    _MyWinUserPort,A0
  85.     CALLEXEC    GetMsg
  86.     Move.l    D0,A1
  87.     Move.l    im_Class(A1),D2        ;D2=IDCMP Flags Directly
  88.     Move.w    im_Code(A1),D3        ;D3=Data ie key why class=Rawkey
  89.     Move.w    im_Qualifier(A1),D4        ;D4=things like CTRL SHIFT
  90.     Move.w    im_MouseX(a1),D5        ;D5=MouseX Coordinate
  91.     Move.w    im_MouseY(a1),D6        ;D5=MouseY Coordinate
  92.     Move.l    im_IAddress(A1),D7        ;D7=Addres of Intuition Obj ie Gadget
  93.     Movem.l    D0-D7/A0-A6,-(A7)    
  94.     CALLEXEC    ReplyMsg
  95.     Movem.l    (a7)+,D0-D7/A0-A6
  96.     Cmp.l    #CLOSEWINDOW,D2
  97.     Bne    WaitLoop
  98.  
  99. Exit
  100.     Move.l    _MyWinBase,A0
  101.     CALLINT    CloseWindow
  102.  
  103. CloseInt
  104.     Move.l    _IntuitionBase,A1
  105.     CALLEXEC    CloseLibrary
  106.  
  107.     Move.l    _DOSBase,A1
  108.     CALLEXEC    CloseLibrary
  109.  
  110.     move.l    reqpos,a0
  111.     move.l    oldreq+2,(a0)
  112.  
  113.  
  114.     move.l    _DOSBASE,a6
  115.     move.l    segaddress,d1
  116.     jmp    -156(a6)            ; unloadseg
  117.  
  118. Error    Moveq    #1,D0
  119.     Rts
  120.  
  121. do_alert:    movem.l    d0-d7/a0-a6,-(a7)
  122.  
  123.     Move.l    _IntuitionBase,A0
  124.     move.l    ib_ActiveWindow(a0),_activewindow
  125.     move.l    ib_ActiveScreen(a0),_activescreen
  126.  
  127.     move.l    #0,lengths
  128.  
  129.     move.l    a1,a0
  130.     
  131.     move.l    12(a0),a1
  132.     move.b    -1(a1),lengths+0
  133.  
  134.     move.l    16(a0),a0        ; line 2
  135.     cmp.l    #0,a0
  136.     beq    req_err
  137.     move.l    12(a0),a1
  138.     move.b    -1(a1),lengths+1
  139.     
  140.     move.l    16(a0),a0        ; line 3
  141.     cmp.l    #0,a0
  142.     beq    req_err
  143.     move.l    12(a0),a1
  144.     move.b    -1(a1),lengths+2
  145.  
  146. req_err:    movem.l    (a7)+,d0-d7/a0-a6
  147.  
  148.     cmp.l    #$16011700,lengths    ; key 880 already set
  149.     beq    req_no
  150.     cmp.l    #$171d0000,lengths    ; disk is corrupt, use diskdoctor
  151.     beq    req_no
  152.     cmp.l    #$0f0f0000,lengths    ; not a dos disk in unit
  153.     beq    req_no
  154.     cmp.l    #$16011300,lengths    ; disk is unreadable, use disk doctor
  155.     beq    req_no
  156.  
  157. oldreq:    jsr    $12345678
  158.  
  159.     movem.l    d0-d7/a0-a6,-(a7)
  160.  
  161.     Move.l    _IntuitionBase,A1
  162.  
  163.     move.l    _activescreen,a0    ; restore original screen
  164.     CALLINT    ScreenToFront    ; after alert - not necessary for Killing 880 reqs
  165.         
  166.     movem.l    (a7)+,d0-d7/a0-a6
  167.     rts    
  168.  
  169. req_no:    clr.l    d0
  170.     rts
  171.  
  172. reqpos:        dc.l    0
  173.  
  174. _IntuitionBase    Dc.l    0
  175. _DOSBase        Dc.l    0
  176. _GfxBase        Dc.l    0
  177.  
  178. _MyWinBase        Dc.l    0
  179. _MyWinRPort        Dc.l    0
  180. _MyWinUserPort    Dc.l    0
  181. _MyWinVPort        Dc.l    0
  182.  
  183. _activewindow:    dc.l    0
  184. _activescreen:    dc.l    0
  185.  
  186. segaddress        dc.l    0
  187. lengths:        dc.l    0
  188.  
  189. IntName        INTNAME
  190. DosName        DOSNAME
  191.  
  192. MainWindow:
  193.     dc.w    100,0    
  194.     dc.w    300,10
  195.     dc.b    0,1    
  196.     dc.l    CLOSEWINDOW+DISKINSERTED
  197.     dc.l    NOCAREREFRESH+WINDOWCLOSE+WINDOWDRAG+WINDOWDEPTH
  198.     dc.l    0    
  199.     dc.l    0    
  200.     dc.l    MainTitle    
  201.     dc.l    0    
  202.     dc.l    0    
  203.     dc.w    5,5    
  204.     dc.w    -1,-1    
  205.     dc.w    WBENCHSCREEN    
  206. MainTitle
  207.     Dc.b    'No880 v1.0a by Shagratt/LSD',0
  208.     Even
  209.  
  210. myname:    dc.b    "No880",0
  211.  
  212.  
  213.  
  214.